package com.ruoyi.pidaijiData.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.pidaijiData.domain.plat.DataPidaijiYy;
import com.ruoyi.pidaijiData.service.IDataPidaijiYyService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 皮带机油压测试数据Controller
 * 
 * @author ruoyi
 * @date 2024-03-04
 */
@RestController
@RequestMapping("/pidaiji/yy")
public class DataPidaijiYyController extends BaseController
{
    @Autowired
    private IDataPidaijiYyService dataPidaijiYyService;

    /**
     * 查询皮带机油压测试数据列表
     */
    @PreAuthorize("@ss.hasPermi('pidaiji:yy:list')")
    @GetMapping("/list")
    public TableDataInfo list(DataPidaijiYy dataPidaijiYy)
    {
        startPage();
        List<DataPidaijiYy> list = dataPidaijiYyService.selectDataPidaijiYyList(dataPidaijiYy);
        return getDataTable(list);
    }

    /**
     * 导出皮带机油压测试数据列表
     */
    @PreAuthorize("@ss.hasPermi('pidaiji:yy:export')")
    @Log(title = "皮带机油压测试数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DataPidaijiYy dataPidaijiYy)
    {
        List<DataPidaijiYy> list = dataPidaijiYyService.selectDataPidaijiYyList(dataPidaijiYy);
        ExcelUtil<DataPidaijiYy> util = new ExcelUtil<DataPidaijiYy>(DataPidaijiYy.class);
        util.exportExcel(response, list, "皮带机油压测试数据数据");
    }

    /**
     * 获取皮带机油压测试数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('pidaiji:yy:query')")
    @GetMapping(value = "/{yyId}")
    public AjaxResult getInfo(@PathVariable("yyId") Long yyId)
    {
        return success(dataPidaijiYyService.selectDataPidaijiYyByYyId(yyId));
    }

    /**
     * 新增皮带机油压测试数据
     */
    @PreAuthorize("@ss.hasPermi('pidaiji:yy:add')")
    @Log(title = "皮带机油压测试数据", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DataPidaijiYy dataPidaijiYy)
    {
        return toAjax(dataPidaijiYyService.insertDataPidaijiYy(dataPidaijiYy));
    }

    /**
     * 修改皮带机油压测试数据
     */
    @PreAuthorize("@ss.hasPermi('pidaiji:yy:edit')")
    @Log(title = "皮带机油压测试数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DataPidaijiYy dataPidaijiYy)
    {
        return toAjax(dataPidaijiYyService.updateDataPidaijiYy(dataPidaijiYy));
    }

    /**
     * 修改皮带机油压测试数据
     */
    @PreAuthorize("@ss.hasPermi('pidaiji:sudu:remove')")
    @Log(title = "修改皮带机油压测试数据", businessType = BusinessType.UPDATE)
    @PutMapping("/editYy/{yyId}")
    @ApiOperation(value="修改皮带机油压测试数据")
    public AjaxResult editYy(@PathVariable Long yyId)
    {
        return toAjax(dataPidaijiYyService.updateDataPidaijiYyByYyId(yyId));
    }

    /**
     * 删除皮带机油压测试数据
     */
    @PreAuthorize("@ss.hasPermi('pidaiji:yy:remove')")
    @Log(title = "皮带机油压测试数据", businessType = BusinessType.DELETE)
	@DeleteMapping("/{yyIds}")
    public AjaxResult remove(@PathVariable Long[] yyIds)
    {
        return toAjax(dataPidaijiYyService.deleteDataPidaijiYyByYyIds(yyIds));
    }
}
